<template>
	<view class="u-p-20">
		<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback">
			<view class="flex flex-column u-p-x-30 bg-white rounded-10">
				<view class="u-p-y-30 border-bottom" v-for="(item,index) in list" :key="index">
					<view class="flex flex-column" @click="itemCLik(item)">
						<view class="flex align-center justify-between">
              <view class="">
                <text class="font-sm font-weight-bold">提现到{{item.type_text}}</text>
                <text class="font-sm u-p-l-20 text-warning">{{item.status | formartStatus}}</text>
              </view>
              <text class="u-font-26 font-weight-bold">提现金额：-{{item.amount}}</text>
						</view>
						<view class="u-m-t-20 flex justify-end">
							<text class="u-font-26">手续费：-{{item.fee}}</text>
						</view>
            <view class="flex align-center justify-between u-m-t-20">
              <text class="font-sm">{{item.createtime}}</text>
              <text class="font-sm">实得(RMB)：{{item.real}}</text>
            </view>
					</view>
				</view>
			</view>
		</mescroll-body>
	</view>
</template>

<script>
	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
	import { MineCenterApi } from '@/api/serves.js'
	export default {
		mixins: [MescrollMixin], // 使用mixin
		data() {
			return {
				list: []
			}
		},
		filters: {
			formartWay(type) {
				let obj = {
					1: '微信',
					2: '支付宝',
					3: '银行卡',
				}
				return obj[type]
			},
			formartStatus(type) {
				let obj = {
					0: '审核中',
					1: '已同意',
					2: '已拒绝',
				}
				return obj[type]
			},
			
		},
		methods: {
			// 下拉刷新回掉
			downCallback() {
				this.mescroll.resetUpScroll() 
			},
			// 上拉加载
			upCallback(page) {
				MineCenterApi.withdrawTxList({ page: page.num}).then(res=> {
					console.log('提现记录', res);
					if(res.code == 1){
						let result = res.data
						if(page.num == 1) this.list = []; //如果是第一页需手动制空列表
						this.list = this.list.concat(result); //追加新数据
						this.mescroll.endBySize(result.length, result.total)
					}else {
						this.$Toast(res.msg)
						this.mescroll.endErr()
					}
				})
			},
			itemCLik(item) {
				if(item.status == 3) {
					uni.showModal({
						title: '驳回理由',
						content: item.remark,
						showCancel: false
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>

</style>
